<?php
/* @var $this AdvertiseController */
/* @var $model Advertise */

$this->breadcrumbs = array(
    'Advertises' => HSUrl::backendAdvertiseUrl()
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').toggle();
    return false;
});
$('.search-form form').submit(function(){
    $('#advertise-grid').yiiGridView('update', {
        data: $(this).serialize()
    });
    return false;
});
");
?>
<?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?>
<div class="search-form" style="display:none">
    <?php $this->renderPartial('_search', array(
        'model' => $model,
    )); ?>
</div><br/>
<br/>
<a href="<?php echo HSUrl::backendCreateAdvertiseUrl() ?>" class="btn btn-default">Create</a>
<div id="" class="admin-main-wrapper form-inline">
    <div class="dataTables_wrapper">
        <?php $this->widget('zii.widgets.grid.CGridView', array(
            'id' => 'advertise-grid',
            'dataProvider' => $model->search(),
            'filter' => $model,
            'columns' => array(
                'id',
                'title',
                array('name' => 'category_id', 'value' => '$data->category->name'),
                'zipcode',
                array('name' => 'published', 'value' => '$data->published  ?"Có":"Không"'),
                array(
                    'class' => 'CButtonColumn',
                ),
            ),
        )); ?>
    </div>
</div>